Calculation formula
- Description
- Special features for use in conditional tables
- Functionality
- Related topics
- Technical documentation
Description
Calculation rules, which do not exist as part of a program but as data generated and managed by the user, are represented in the ClassiX® system by objects of class CX_FORMULA.
- general overview
- Variable of a formula
- Constants
- Operators, arithmetic functions
- special functions within a formula expression
- InstantView® and class CX_FORMULA
- Examples
Before a formula can be calculated, values must be assigned to the variables occurring in the formula. This is done automatically with the objects previously registered in the PlugSpace.
The variables occurring in a formula can themselves represent a formula or a condition table (object CX_CONDITIONED_BAG).
The formula object can determine which variables it needs for the calculation (also in case of a formula in the formula etc.).
The module Test Formula constructs a window for the input of variable values. For this purpose an object of the class CX_CONTAINER is used - an object whose only function is to hold any dynamic data fields.
The result of a formula calculation can be a value - in case of an arithmetic expression - or TRUE/FALSE as the result of a logical expression.
A formula ending with ; will not return a value.
Attention:
- The formula only calculates when the formula is ended / completed.
- Value assignments to external variables are only executed when the formula is ended.
Special features for use in conditional tables
Attention:
If a variable definition (local a;) is present in the condition for conditional tables, no column may be inserted in the table, since the columns are evaluated before the rest of the condition and thus a separation by a semicolon would occur in the middle of the condition!
In this case the following message is displayed when leaving the line: Operand expected!
Attention:
If columns are defined in a conditional table and the additional condition contains an OR link, then the entire additional condition must be placed in brackets, otherwise the preceding condition columns are ignored if the OR area is true!
Example: (rF="right rising"|rF="left falling")
Functionality
Input window
This window is used to maintain calculation formulas. You can select a calculation formula by entering the desired number in the Number field and confirming with RETURN. If you want to call up the list window, you can select the menu item "Search".
Via the menu item 'Basic data - Calculation formulas' you reach the corresponding search window, in which all current calculation formulas are displayed.
Double-clicking on one of the entries opens the 'Calculation formula' window and you can edit the entry. With OK you save the changes.
With 'New' it is possible to create a new formula. Enter a consecutive number or a term in the field 'No.' and select a meaningful name for the field 'Name'. In the field 'Formula' you can now enter a formula that the system should convert.
You can then use the 'Edit - Test formula' item to test whether the formula is implemented correctly. With OK you save your entries.
Menu item | Description |
---|---|
Edit | - |
: Test calculation formula | Calculating a formula means that its expression is evaluated. A new window opens, in which the values occurring in the formula can be entered. (test formula) |
: Internal representation | Opens a window showing the internal representation of the formula in postfix notation. This coding allows a very fast calculation. For conditional expressions, condition and dependent terms are displayed in if ... fi or if ... else ... fi, with fi as the "closing bracket for each if. |
Close | Close window |
Search | Call up list window |
Examples | With the menu item Examples you can display a list of different formulas, which you can select by clicking on them. You can also enter or change formulas yourself (before calculation with the button Save input!). |
Symbol | Description |
---|---|
Create new calculation formula | |
Save changes | |
Delete calculation formula | |
Print calculation formula | |
Calculating a formula means that its expression is evaluated. A new window opens, in which the values occurring in the formula can be entered. (test formula) |
Field/button | Description |
---|---|
Formula description | |
: Identifier | Unique identifier of the formula |
Description | Description of what the formula calculates |
Formula expression | |
: Formula expression | Indication of the calculation rules of the formula. Notes on syntax are described above in the text |
button | Description |
---|---|
OK | Changes to the calculation formula are saved. If no changes are made, the button is locked. |
New | The input window is cleared. |
Delete | The displayed calculation formula is deleted. |
Close | The window is closed without saving changes. If you want to save the changes, you must press the "OK" button. |
Editor window
This window is used for the structured maintenance of a formula using a special XML control.
Field/button | Description |
---|---|
Transform | The formula expression is prepared in a structured way |
Edit/View | Change the mode between viewing and editing the formula using the control |
Properties | Displaying the properties of the XMLEdit control |
List window
Menu item | Description |
---|---|
Edit | - |
: Data exchange | |
: : Export | Exports the selected calculation formulas to an export Ascii file to be specified |
: : Import | Imports the calculation formulas contained in the file to be selected. If they already exist, they are only updated |
Symbol | Description |
---|---|
Create new calculation formula | |
Edit calculation formula | |
Delete calculation formula | |
Print calculation formulas | |
Export calculation formulas | |
Copy all calculation formulas to the clipboard |
Field | Description |
---|---|
Identifier | Search for a formula using the identifier |
Description | Search for a formula using the description |
button | Description |
---|---|
Edit | The current calculation formula is displayed in the input window. |
New | An empty input window opens. |
Delete | The selected calculation formula is deleted. |
Close | The window is closed. |
Selection window
This window is used to select a calculation formula.
Field | Description |
---|---|
No. | Search by formula number |
Name | Search by formula name |
button | Description |
---|---|
OK | The selected calculation formula object is taken over. |
Close | The selection is cancelled. |
Examples
The prepared examples use the following variables:
l | Length | (Class CX_VALUE) |
b | Width | (Class CX_VALUE) |
ma | Type of material | (enumeration) |
ID | Position of a technical component | (enumeration) |
d | Date | (Class CX_DATE) |
t | Time | (Class CX_TIME) |
comment | a comment as a character string | (String) |
Field | Description |
---|---|
Simple formulas | Arithmetic expressions are calculated. |
Assignments | A value is assigned to a variable. This can be the main purpose of the formula, which does not necessarily have to give a result. |
If...then... | Conditions are also understood as expressions. Note: The last three lines show different spellings for the same calculation rule |
Related topics
- Index
- Test calculation formula
- Quantity/fixed quantities Calculation in the parts list
- Time calculation in the work plan
- Conditional table
Technical documentation
Overview
Calculation formula basic module
Module name
formula.mod
Classes
Security
In addition to restricting access rights via the class and its data fields, the module can be restricted in its use via some of the received messages.
Message | Parameters | Function | Security |
---|---|---|---|
FORMULA_CHANGED | Calculation formula object | Calculation formula has been changed | |
FORMULA_CREATED | Calculation formula object | Calculation formula was generated | |
FORMULA_DELETED | Calculation formula object | Calculation formula was deleted |
Message | Parameters | Function | Receiver module |
---|---|---|---|
EDIT_FORMULA | NULL or calculation formula object | Call up the input window for the calculation formula | Calculation formula editing module |
Calculation formula editing module
Module name
formulated.mod
Classes
Security
In addition to restricting access rights via the class and its data fields, the module can be restricted in its use via some of the received messages.
Message | Parameters | Function | Security |
---|---|---|---|
EDIT_FORMULA | NULL or calculation formula object | Call up the input window for the calculation formula | |
FORMULA_CHANGED | Calculation formula object | Calculation formula has been changed | |
FORMULA_CREATED | Calculation formula object | Calculation formula was generated | |
FORMULA_DELETED | Calculation formula object | Calculation formula was deleted | |
FORMULA_SELECTED | Calculation formula object | Calculation formula was selected | |
LIST_FORMULA | Collection calculation formula objects or NULL | Open the list window for calculation formula | |
LOAD_FORMULA | Import calculation formula |
Message | Parameters | Function | Receiver module |
---|---|---|---|
EDIT_FORMULA | NULL or calculation formula object | Call up the input window for the calculation formula | Calculation formula editing module |
FORMULA_CHANGED | Calculation formula object | Calculation formula has been changed | |
FORMULA_CREATED | Calculation formula object | Calculation formula was generated | |
FORMULA_DELETED | Calculation formula object | Calculation formula was deleted | |
LIST_FORMULA | Open the list window for calculation formula | Calculation formula editing module | |
SHOW_FORMULA_SAMPLES | X-position, Y-position, recipient of the reply | Examples of calculation formulas | |
SHOW_PREVIEW | Widget | Print Preview | Print Preview |
TEST_FORMULA | Formula object | Test the formula | Test FormulaModule |
Calculation formula selection module
Module name
formula.mod
Classes
Security
In addition to restricting access rights via the class and its data fields, the module can be restricted in its use via some of the received messages.
Message | Parameters | Function | Security |
---|---|---|---|
FORMULA_CHANGED | Calculation formula object | Calculation formula has been changed | |
FORMULA_CREATED | Calculation formula object | Calculation formula was generated | |
FORMULA_DELETED | Calculation formula object | Calculation formula was deleted | |
SELECT_FORMULA | Collection calculation formula objects or NULL, recipient of the response | Open selection window for calculation formula |
Message | Parameters | Function | Receiver module |
---|---|---|---|
EDIT_FORMULA | NULL or calculation formula object | Call up the input window for the calculation formula | Calculation formula editing module |
FORMULA_SELECTED | Calculation formula object, recipient | Calculation formula was selected |